$(function(){
			//只骰子
			var prev = 0;
			var playnum = 10000; //初始次数，由后台传入
			$('.times').html(playnum);
			var isture = 0;
			if(isture) return; // 如果在执行就退出
			isture = true; // 标志为 在执行
			
			//点击开始按钮
			$(".start").on("click",function(){
				$(".group-btn").hide();
				$(".home-bottom").show();
			});
			//点击签到
			$(".signIn").on("click",function(){
				$(".sign-alert").show();
			});
			$(".sign-rule").on("click",function(){
				$(".rule-alert").show();
			});
			//点击攻略按钮
			$(".rule").on("click",function(){
				$(".richerRule-alert").show();
			});
			//点击继续游戏
			$(".continue-btn").on("click",function(){
				$(".card-alert").hide();
			});
			//点击弹框关闭按钮
			$(".close-btn").on("click",function(){
				$(".sign-alert").hide();
				$(".rule-alert").hide();
				$(".sign-success").hide();
				$(".richerRule-alert").hide();
			});
			//点击签到规则关闭按钮
			$(".rule-alert .close-btn").on("click",function(){
				$(".rule-alert").hide();
				$(".sign-alert").show();
			});
			//点击全民集卡
			$(".collect-card").on("click",function(){ 
				$(".card-word").hide();
				$(".card-alert").show();
				$(".all-card").show();
			});
			
			//签到次数
			var signNum=0;
			$(".click-sign").on("click",function(){
				signNum=signNum+1;
				$(".sign-num").text(signNum);
				setTimeout(function(){
					if(signNum < 7){
						$(".sign-success").show();
						$(".sign-success .alert-con").show();
						$(".calender-num").text("0"+signNum);
						$(".sign-num").text(signNum);
						$(".residue-seven").text(7-signNum);
					}else if(signNum == 7){
						$(".sign-success").show();
						$(".sign-success .alert-conseven").show();
					}else if(signNum > 7 && signNum < 15){ console.log(signNum);
						$(".sign-success").show();
						$(".sign-success .alert-con").show();
						if(signNum < 10){
							$(".calender-num").text("0"+signNum);
						}else if(signNum >=10 && signNum < 15){
							$(".calender-num").text(signNum);
						}
						$(".sign-level").text(15);
						$(".throw-num").text(4);
						$(".sign-num").text(signNum);
						$(".residue-seven").text(15-signNum);
					}else if(signNum == 15){
						$(".sign-success").show();
						$(".sign-success .alert-conseven").show();
						$(".calender-num").text(signNum);
						$(".sign-level").text(15);
						$(".throw-num").text(4);
					}else if(signNum >15 && signNum < 31){
						$(".sign-success").show();
						$(".sign-success .alert-conthirty").show();
						$(".calender-num").text(signNum);
						$(".sign-num").text(signNum);
						$(".residue-seven").text(31-signNum);
					}else if(signNum == 31){
						$(".sign-success").show();
						$(".sign-success .alert-conallday").show();
					}
				},8000)
			});
			
			//骰子
			var dice = $("#dice");
			dice.click(function(){
				if(playnum <= 0) { //当抽奖次数为0的时候执行
					$('.times').html(0);
					isture = false;
				} else { //还有次数就执行
					playnum = playnum - 1; //执行转盘了则次数减1
					if(playnum <= 0) {
						playnum = 0;
					}
					$('.times').html(playnum);
					clickfunc();
				}
				//点击骰子要执行的函数
				function clickfunc(){
					$(".wrap").append("<div id='dice_mask'></div>");//加遮罩
					dice.attr("class","dice");//清除上次动画后的点数
					dice.css('cursor','default');
					var num = Math.floor(Math.random()*6+1);//产生随机数1-6
					$(".num").text(num);
					dice.animate({left: '+2px'}, 100,function(){
						dice.addClass("dice_t");
					}).delay(200).animate({top:'-2px'},100,function(){
						dice.removeClass("dice_t").addClass("dice_s");
					}).delay(200).animate({opacity: 'show'},600,function(){
						dice.removeClass("dice_s").addClass("dice_e");
					}).delay(100).animate({left:'-2px',top:'2px'},100,function(){
						dice.removeClass("dice_e").addClass("dice_"+num);
						$("#result").html("您掷得点数是<span>"+num+"</span>");
						dice.css('cursor','pointer');
						$("#dice_mask").remove();//移除遮罩
						roll(prev+1, prev+num); //逐步运动动画 
					});
					
					
					
					var winingInfo=["陪","文字寻宝","大转盘","找你弟","听歌","你","切瓜","礼","晒","听歌","楼盘案名","文字寻宝","切瓜","大转盘","谢谢参与","礼","郑","楼盘案名","文字寻宝","大转盘","州","找你弟","楼盘案名","找你弟","礼","听歌","切瓜"];
					$(".alert button").click(function(){
						$("#alert_mask").hide()
					})
					
					function roll(i, step) {
						var time = setInterval(function() {
							if(i == 92) {
								$(".rhombus" + 92).append("<div class='trigalle-lmask'></div><div class='trigalle-rmask'></div><div id='mask-img'></div>");
								$(".rhombus" + (91)).find(".trigalle-lmask").remove();
								$(".rhombus" + (91)).find(".trigalle-rmask").remove();
								$(".rhombus" + (91)).find(".mask-img").remove();
								clearInterval(time); //如果到达指定位置则停止 
							}else{ 
								console.log(i);
								$(".rhombus" + i).append("<div class='trigalle-lmask'></div><div class='trigalle-rmask'></div><div id='mask-img'></div>");
								$(".rhombus" + (i-1)).find(".trigalle-lmask").remove();
								$(".rhombus" + (i-1)).find(".trigalle-rmask").remove();
								$(".rhombus" + (i-1)).find("#mask-img").remove();
								prev=i;
								//向下的路线
								if((i>5 && i<9) ||(i>9 && i< 12) ||(i>15 && i<18)||(i>18 && i<22) ||(i>25 && i<29)||(i>29 && i<32)||(i>35 && i<41)||(i>41 && i<47)){
//									$(".rhombus" + i).find("#mask-img").css({"background-image":"url(http://reald-xjd.oss-cn-beijing.aliyuncs.com/xws/house-richer/richer-home/img/role1.png)","-webkit-transform":"rotateY(-37deg))","transform":"rotateY(-37deg)"});
									$(".rhombus" + i).find("#mask-img").css({"-webkit-transform":"rotateY(130deg))","transform":"rotateY(130deg)"});
								}
								if((i>8 && i<10)||(i>11 && i< 16)||(i>17 && i<19)||(i>21 && i<26)||(i>28 && i<30)||(i>31 && i<37)||(i>40 && i<42)){
									$(".rhombus" + i).find("#mask-img").css({"-webkit-transform":"rotateY(0deg))","transform":"rotateY(0deg)"});
								}
								//向上的路线
								if((i>46 && i<52) ||(i>53 && i< 55) ||(i>57 && i<62)||(i>64 && i<66) ||(i>67 && i<72)||(i>73 && i<75)||(i>77 && i<81)||(i>84 && i<87)){
									$(".rhombus" + i).find("#mask-img").css({"left":"26px","background-image":"url(http://s10.realdtech.com/xws/house-richer/richer-home/img/role1.png)"});
//								
								}
								if((i>51 && i<54)||(i>54 && i< 58)||(i>61 && i<65)||(i>65 && i<68)||(i>71 && i<74)||(i>74 && i<78)||(i>80 && i<84)||(i>86 && i<92)){
									$(".rhombus" + i).find("#mask-img").css({"left":"-7px","background-image":"url(http://s10.realdtech.com/xws/house-richer/richer-home/img/role1.png)","-webkit-transform":"rotateY(180deg))","transform":"rotateY(180deg)"});
									
								}
								
							}
//							var step =48;
							if(i == step) {
								console.log(i);
								console.log(window.screen.width);
								console.log(window.screen.height)
								console.log($(".rhombus" + i).offset().top);
								console.log($(".rhombus" + i).offset().left);
								var leftx = parseInt($(".rhombus" + i).offset().left)-parseInt(window.screen.width);
								var topy = parseInt($(".rhombus" + i).offset().top)-parseInt(window.screen.height)
								console.log(leftx);
								console.log(topy)
								if( leftx>0){
									$("html,body").animate({"scrollLeft":"320px","scrollTop":topy+240+"px"}, 1000);
									if(topy > 0){
										$("html,body").animate({"scrollLeft":"320px","scrollTop":topy+240+"px"}, 1000);
									}
								}
								if(leftx < 0){
									$("html,body").animate({"scrollLeft":"100px","scrollTop":topy+240+"px"}, 1000);
									if(topy > 0){
										$("html,body").animate({"scrollLeft":"100px","scrollTop":topy+240+"px"}, 1000);
									}
								}
								
								
								
								clearInterval(time); //如果到达指定位置则停止 
								$("#dice_mask").remove(); //移除遮罩 
								setTimeout(function(){
									//在这儿 i是走到对应的方格
									switch (i){
										case 1:break;
										case 2:break;
										case 3:
											$(".trigalle-lmask").show();
											$(".trigalle-rmask").show();
											$(".card-alert").show();
											$(".card-alert .card-word").show();
											$(".words-one img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-pei.jpg");
											break;
										case 4:break;
										case 5:break;
										case 6:break;
										case 7:break;
										case 8:break;
										case 9:break;
										case 10:break;
										case 11:break;
										case 12:break;
										case 13:break;
										case 14:break;
										case 15:break;
										case 16:break;
										case 17:
											$(".trigalle-lmask").show();
											$(".trigalle-rmask").show();
											$(".card-alert").show();
											$(".card-alert .card-word").show();
											$(".pei img").attr("src","img/g-ni.png");
											$(".card-alert .card-word").find("p").eq(1).css("color","#319921");
											$(".card-alert .card-word").find("p").eq(2).css("color","#319921");
											$(".card-alert .card-word .word").text("你");
											$(".words-one img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-pei.jpg");
											$(".words-two img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-ni.jpg");
											break;
										case 18:break;
										case 19:break;
										case 20:break;
										case 21:break;
										case 22:break;
										case 23:break;
										case 24:break;
										case 25:break;
										case 26:break;
										case 27:break;
										case 28:break;
										case 29:break;
										case 30:
											$(".trigalle-lmask").show();
											$(".trigalle-rmask").show();
											$(".card-alert").show();
											$(".card-alert .card-word").show();
											$(".pei img").attr("src","img/g-shai.png");
											$(".card-alert .card-word").find("p").eq(1).css("color","#ca51ff");
											$(".card-alert .card-word").find("p").eq(2).css("color","#ca51ff");
											$(".card-alert .card-word .word").text("晒");
											$(".words-one img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-pei.jpg");
											$(".words-two img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-ni.jpg");
											$(".words-three img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-shai.jpg");
											break;
										case 31:break;
										case 32:break;
										case 33:break;
										case 34:break;
										case 35:break;
										case 36:break;
										case 37:break;
										case 38:break;
										case 39:break;
										case 40:break;
										case 41:break;
										case 42:break;
										case 43:break;
										case 44:break;
										case 45:break;
										case 46:
											$(".trigalle-lmask").show();
											$(".trigalle-rmask").show();
											$(".card-alert").show();
											$(".card-alert .card-word").show();
											$(".pei img").attr("src","img/g-thank.png");
											$(".card-alert .card-word").find("p").eq(0).text("哎呦，这次有点背哦");
											$(".card-alert .card-word").find("p").eq(1).text("点背不能赖社会，那你能赖谁？").css("color","#f95860");
											$(".card-alert .card-word").find("p").eq(2).text("我就不信，再试一次，还会这么背！").css("color","#f95860");
											$(".card-alert .card-word .word").text("谢谢");
											$(".words-one img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-pei.jpg");
											$(".words-two img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-ni.jpg");
											$(".words-three img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-shai.jpg");
											break;
										case 47:break;
										case 48:break;
										case 49:break;
										case 50:break;
										case 51:break;
										case 52:break;
										case 53:break;
										case 54:break;
										case 55:
											$(".trigalle-lmask").show();
											$(".trigalle-rmask").show();
											$(".card-alert").show();
											$(".card-alert .card-word").show();
											$(".pei img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/g-zheng.png");
											$(".card-alert .card-word").find("p").eq(1).css("color","#008ec9");
											$(".card-alert .card-word").find("p").eq(2).css("color","#008ec9");
											$(".card-alert .card-word .word").text("郑");
											$(".words-one img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-pei.jpg");
											$(".words-two img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-ni.jpg");
											$(".words-three img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-shai.jpg");
											$(".words-four img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-zheng.jpg");
											break;
										case 56:break;
										case 57:break;
										case 58:break;
										case 59:break;
										case 60:break;
										case 61:break;
										case 62:break;
										case 63:break;
										case 64:break;
										case 65:break;
										case 66:break;
										case 67:break;
										case 68:break;
										case 69:break;
										case 70:break;
										case 71:
											$(".trigalle-lmask").show();
											$(".trigalle-rmask").show();
											$(".card-alert").show();
											$(".card-alert .card-word").show();
											$(".pei img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/g-zhou.png");
											$(".card-alert .card-word").find("p").eq(1).css("color","#fa994b");
											$(".card-alert .card-word").find("p").eq(2).css("color","#fa994b");
											$(".card-alert .card-word .word").text("州");
											$(".words-one img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-pei.jpg");
											$(".words-two img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-ni.jpg");
											$(".words-three img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-shai.jpg");
											$(".words-four img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-zheng.jpg");
											$(".words-five img").attr("src","http://s10.realdtech.com/xws/house-richer/richer-home/img/s-zhou.jpg");
											setTimeout(function(){
												$(".card-alert .card-word").hide();
												$(".add-dice1").show();
											},2000)
											break;
										case 72:break;
										case 73:break;
										case 74:break;
										case 75:break;
										case 76:break;
										case 77:break;
										case 78:break;
										case 79:break;
										case 80:break;
										case 81:break;
										case 82:break;
										case 83:break;
										case 84:break;
										case 85:break;
										case 86:break;
										case 87:break;
										case 88:break;
										case 89:break;
										case 91:break;
										case 92:break;
									}
								},1000)
							}
							i++; //继续前进 
						}, 500);
					}
					
				}
			});
		});